
/**====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*

dl_disp.h

Copyright (c) 2003 by CHIPNUTS Incorporated. All Rights Reserved.
*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/

/**===========================================================================

 Revisions of dl_disp.h
 Version  		Name       	Date		Description
 1.0  			Eagle	  	11/23/2004  	Initial Version  

*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/
#ifndef DL_DISPLAY_HEAD_FILE
#define DL_DISPLAY_HEAD_FILE


#include "sys.h"
#include "display.h"

#define DL_DISP_MAX_DEV_NUM 10

#define DL_DISP_COLOR_8		1
#define DL_DISP_COLOR_4K		2
#define DL_DISP_COLOR_64K		4
#define DL_DISP_COLOR_262K		8

enum{
	DL_DISP_RET_SUCCESS,
	DL_DISP_RET_FAIL
};

typedef UINT8 DL_DISP_RET_T;

enum
{
	DL_LCD_MAIN_SCREEN,
	DL_LCD_SUB_SCREEN
};
typedef UINT8 DL_DISP_DEV_ID_T;


typedef struct
{
	UINT8 		x_pos;		// start position x of the rectangle 
	UINT8 		y_pos;		// start postion y of the rectangle 
	UINT8 		width;		// width of the rectangle
	UINT8 		height;		// height of the rectangle
	UINT16 	clr_line;	// the line color of the rcectangle
	UINT16 	clr_fill;	// the filled color of the rectangle 
}LCD_WIN_T;

#define LCD_SET_MAIN	0X0000
#define LCD_SET_SUB		0X0001
#define LCD_SET_BOTH	0X0002


typedef DL_DISP_RET_T (*DL_DISP_FUNC_DEV_INIT_T)(void);
typedef DL_DISP_RET_T (*DL_DISP_FUNC_UPDATE_DSP_T)(RECT_T * p_rect, UINT8* p_buf);
typedef DL_DISP_RET_T (*DL_DISP_FUNC_CLN_SCN_T)(void);
typedef DL_DISP_RET_T (*DL_DISP_FUNC_DSP_ON_T)(void);
typedef DL_DISP_RET_T (*DL_DISP_FUNC_DSP_OFF_T)(void);
typedef DL_DISP_RET_T (*DL_DISP_FUNC_STANDBY_ON_T)(void);
typedef DL_DISP_RET_T (*DL_DISP_FUNC_STANDBY_OFF_T)(void);
typedef DL_DISP_RET_T (*DL_DISP_FUNC_SLEEP_ON_T)(void);
typedef DL_DISP_RET_T (*DL_DISP_FUNC_SLEEP_OFF_T)(void);

typedef struct{
	UINT16 color;
	UINT16 width;
	UINT16 height;
} DL_DISP_DEV_INFO_T;
typedef struct{
	const char* p_name;
	DL_DISP_DEV_INFO_T	info;
	DL_DISP_FUNC_DEV_INIT_T func_dev_init;
	DL_DISP_FUNC_UPDATE_DSP_T func_update_win;
	DL_DISP_FUNC_CLN_SCN_T func_cln_scn;
	DL_DISP_FUNC_DSP_ON_T func_dsp_on;
	DL_DISP_FUNC_DSP_OFF_T func_dsp_off;
	DL_DISP_FUNC_STANDBY_ON_T func_standby_on;
	DL_DISP_FUNC_STANDBY_OFF_T func_standby_off;
	DL_DISP_FUNC_SLEEP_ON_T func_sleep_on;
	DL_DISP_FUNC_SLEEP_OFF_T func_sleep_off;
} DL_DISP_DEVICE_T;

extern const DL_DISP_DEVICE_T LCD_HD66773;
extern const DL_DISP_DEVICE_T LCD_HD66789;
extern const DL_DISP_DEVICE_T LCD_HD66789_16;
extern const DL_DISP_DEVICE_T LCD_S1D19102;
extern const DL_DISP_DEVICE_T LCD_HX8312;

extern DL_DISP_DEV_ID_T dl_disp_dev_register(DL_DISP_DEVICE_T* p_dev);
extern DL_DISP_RET_T dl_disp_dev_init(DL_DISP_DEV_ID_T dev_id);
extern DL_DISP_RET_T dl_disp_scn_clean(DL_DISP_DEV_ID_T dev_id);
extern DL_DISP_RET_T dl_lcd_hd66773_back_light_init(UINT8 cnt);

extern DL_DISP_DEV_ID_T dl_disp_dev_register(DL_DISP_DEVICE_T* p_dev);

extern DL_DISP_RET_T dl_disp_scn_disp(RECT_T * p_rect, void * p_buf, DL_DISP_DEV_ID_T dev_id);

extern DL_DISP_RET_T dl_disp_disp_on(DL_DISP_DEV_ID_T dev_id);

extern DL_DISP_RET_T dl_disp_disp_off(DL_DISP_DEV_ID_T dev_id);


#endif
